let http = require('http');

let options = {
    hostname: '127.0.0.1',
    port: 3000,
    path: '/ikejcwang/syaHello?method=sayHello',
    method: 'POST',
    headers: {
        'connection': 'close'   // 测试短链接
    }
};

let req = http.request(options, function (res) {
    console.log('STATUS: ' + res.statusCode);
    console.log('HEADERS: ' + JSON.stringify(res.headers));

    let body = []
    res.addListener('data', function (chunk) {
        body.push(chunk);
    });
    res.addListener('end', () => {
        console.log('response body:' + body.toString());
    })
});
req.on('error', function (e) {
    console.log('problem with request_test: ' + e.message);
});
req.end('hello http1.1 version');